<%-- 
    Document   : ProductInsert2
    Created on : 2014/2/26, 下午 03:16:27
    Author     : Gjun
--%>

<%@page import="java.sql.DriverManager"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%    
        request.setCharacterEncoding("UTF-8");
               
        String product_name=request.getParameter("product_name");
        String img_url=request.getParameter("img_url");
        String product_price=request.getParameter("product_price");
        String product_info=request.getParameter("product_info");
        String product_stock=request.getParameter("product_stock");
            
        Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
        java.sql.Connection con=
                DriverManager.getConnection("jdbc:sqlserver://10.10.2.171:1433;databaseName=javadb",
                        "javadb","javadb");
        java.sql.Statement st=con.createStatement();
        String sql="Insert into dbo.product (product_name,img_url,product_price,product_info,product_stock) values('"+product_name+"','"+img_url+"','"+product_price+"','"+product_info+"','"+product_stock+"')";
        int x=st.executeUpdate(sql);
        System.out.println("異動"+x+"筆資料");
        st.close();
        con.close();
%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <a href="ProductManagement.jsp">back</a>
    </body>
</html>
